// 解散房间 投票用户头像
class playImageVote extends eui.Component{
    
    public constructor(){
        super();
        this.once(eui.UIEvent.COMPLETE,this.onComplete,this);
        this.skinName = "src/Game/gameRoom/window/playImageVoteSkin.exml";
    }
    private onComplete(){
        this.init();
        this.once(egret.Event.REMOVED_FROM_STAGE,this.onRemove,this);
    }
    private onRemove(){
    }

    private image_mask:eui.Image;
    private name_Txt:eui.Label;
    private fz_ui:eui.Image;
    private image_offLine:eui.Image;
    private state_Txt:eui.Label;

    private ImagePic:egret.Sprite;
    private init(){
        this.ImagePic = new egret.Sprite();
        this.addChild(this.ImagePic);
        this.ImagePic.x = 5;
        this.ImagePic.y = 28;
        this.ImagePic.mask = this.image_mask;
        this.addChild(this.image_offLine);
        this.addChild(this.fz_ui);
    }
    //设置投票
    public setVote(value:boolean = true){
        if(value){
            this.fz_ui.visible = true;
        }else{
            this.fz_ui.visible = false;
        }
    }
    //设置离线
    public setOffLine(value:boolean=true){
        if(value){
            this.image_offLine.visible = true;
            this.state_Txt.text = "离线";
        }else{
            this.image_offLine.visible = false;
            this.state_Txt.text = "在线";
        }
    }
    //设置数据内容
    private ImageUrl:string;    
    public setContent(imageUrl:string,userName:string){
        if(imageUrl!=this.ImageUrl){
            this.ImageUrl = imageUrl;
            if(this.ImagePic.numChildren){
                this.ImagePic.removeChildAt(0);
            }
            var img:loadImage = new loadImage(imageUrl,73);
            this.ImagePic.addChild(img);
        }else{
        }
        this.name_Txt.text = StringOmit.getChar(userName,12);
    }
}